home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
message
/
messag
/
mdimain.fr_
/
mdimain.fr
Wrap
Text File
|
1995-01-14
|
18KB
|
509 lines
VERSION 2.00
Begin MDIForm MDImain
Caption = "Message.VBX Demo"
ClientHeight = 4950
ClientLeft = 420
ClientTop = 1770
ClientWidth = 8760
Height = 5640
Icon = MDIMAIN.FGX:0000
Left = 360
LinkTopic = "MDIForm1"
Top = 1140
Width = 8880
Begin PictureBox PicStatus
Align = 2 'Align Bottom
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Height = 420
Left = 0
ScaleHeight = 420
ScaleWidth = 8760
TabIndex = 0
Top = 4530
Width = 8760
Begin Timer Timer1
Interval = 500
Left = 3000
Top = 0
End
Begin Message Message1
Left = 2520
Top = 0
End
Begin Label LblSBcaps
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "CAPS"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 225
Left = 7260
TabIndex = 5
Top = 100
Width = 615
End
Begin Label LblSBnum
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "NUM"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 225
Left = 7980
TabIndex = 4
Top = 100
Width = 615
End
Begin Label LblSBdate
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "12/25/96"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 225
Left = 4920
TabIndex = 3
Top = 100
Width = 795
End
Begin Label LblSBtime
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "00:00"
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 225
Left = 4020
TabIndex = 2
Top = 105
Width = 795
End
Begin Label LblStatus
BackStyle = 0 'Transparent
Caption = "Menu Status Goes Here..."
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Arial"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 225
Left = 120
TabIndex = 1
Top = 100
Width = 3795
End
End
Begin Menu mnuDemos
Caption = "&Demos"
Begin Menu mnuDemosMoveForm
Caption = "Moving Captionless &Form..."
End
Begin Menu mnuDemosMoveControl
Caption = "Moving &Controls..."
End
Begin Menu mnuDemosSep01
Caption = "-"
End
Begin Menu mnuDemosExit
Caption = "E&xit"
End
End
Begin Menu mnuHelp
Caption = "&Help"
Begin Menu mnuHelpContents
Caption = "VBX Help &Contents..."
End
Begin Menu mnuHelpSearch
Caption = "VBX Help &Search..."
End
Begin Menu mnuHelpSep01
Caption = "-"
End
Begin Menu mnuHelpAbout
Caption = "&About..."
End
Begin Menu mnuHelpSep02
Caption = "-"
End
Begin Menu mnuHelpCatalog
Caption = "Catalog of &Products..."
End
Begin Menu mnuHelpReg
Caption = "Online &Registration..."
End
Begin Menu mnuHelpOrder
Caption = "&Order Form..."
End
Begin Menu mnuHelpEval
Caption = "&Evaluation Form..."
End
Begin Menu mnuHelpShareware
Caption = "Shareware &Information..."
End
End
End
Sub DoPicChild3D (Obj As Control, Style, thick)
'draws 3D shadows effects around a control
'Style is either "sunken" or "raised"
'use this function in the Paint event of the form
If thick <= 0 Then thick = 1
If thick > 8 Then thick = 8
OldMode = Obj.Parent.PicStatus.ScaleMode
OldWidth = Obj.Parent.PicStatus.DrawWidth
Obj.Parent.PicStatus.ScaleMode = 3
Obj.Parent.PicStatus.DrawWidth = 1
ObjHeight = Obj.Height
ObjWidth = Obj.Width
ObjLeft = Obj.Left
ObjTop = Obj.Top
Select Case LCase$(Style)
Case "sunken":
TLshade = QBColor(8)
BRshade = QBColor(15)
Case "raised":
TLshade = QBColor(15)
BRshade = QBColor(8)
End Select
For i = 1 To thick
CurLeft = ObjLeft - i
CurTop = ObjTop - i
CurWide = ObjWidth + (i * 2) - 1
CurHigh = ObjHeight + (i * 2) - 1
Obj.Parent.PicStatus.Line (CurLeft, CurTop)-Step(CurWide, 0), TLshade
Obj.Parent.PicStatus.Line -Step(0, CurHigh), BRshade
Obj.Parent.PicStatus.Line -Step(-CurWide, 0), BRshade
Obj.Parent.PicStatus.Line -Step(0, -CurHigh), TLshade
Next i
If thick > 2 Then
CurLeft = ObjLeft - thick - 1
CurTop = ObjTop - thick - 1
CurWide = ObjWidth + ((thick + 1) * 2) - 1
CurHigh = ObjHeight + ((thick + 1) * 2) - 1
Obj.Parent.PicStatus.Line (CurLeft, CurTop)-Step(CurWide, 0), QBColor(0)
Obj.Parent.PicStatus.Line -Step(0, CurHigh), QBColor(0)
Obj.Parent.PicStatus.Line -Step(-CurWide, 0), QBColor(0)
Obj.Parent.PicStatus.Line -Step(0, -CurHigh), QBColor(0)
End If
Obj.Parent.PicStatus.ScaleMode = OldMode
Obj.Parent.PicStatus.DrawWidth = OldWidth
End Sub
Sub MDIForm_Load ()
Screen.MousePointer = 11
FormCenterScreen Me
initialize
LblStatus.Caption = ""
LblSBtime.Caption = ""
LblSBdate.Caption = ""
'define the hWnd for Message to Receive messages from
Message1.hWindow = Me.hWnd
'now define the various message we want to intercept
Message1.Status(WM_MenuSelect) = True 'for menu dragging messages
Message1.Status(WM_SysCommand) = True 'for custom sysmenu item responses and messages
Message1.Status(WM_GetMinMaxInfo) = True 'to set minimum and maximum form resize
'add a new system menu item
SysMenuAppendLine Me, 2000
SysMenuAppendMsg Me, "This is test #&1...", 2001
SysMenuAppendMsg Me, "This is test #&2...", 2002
SysMenuAppendMsg Me, "This is test #&3...", 2003
mnuhelp.Caption = Chr$(8) + mnuhelp.Caption
Timer1_Timer
FirstMsg.Show
Screen.MousePointer = 0
End Sub
Sub Message1_Receive (Msg As Integer, wParam As Integer, lParam As Long, UseRetVal As Integer, RetVal As Long)
If Msg = WM_MenuSelect Then 'menu message
If wParam < 0 Then
'system menu
Select Case wParam 'these are standard SysMenu wParam codes
Case -3808: SBmsg$ = "Restore the demo window size"
Case -4080: SBmsg$ = "Move the demo window"
Case -4096: SBmsg$ = "Change the demo window size"
Case -4064: SBmsg$ = "Minimize the demo to an icon"
Case -4048: SBmsg$ = "Maximize the demo window"
Case -4000: SBmsg$ = "Close the demo application"
Case -3792: SBmsg$ = "Display the task list"
End Select
LblStatus.Caption = " " + SBmsg$
Exit Sub
'no item selected
ElseIf wParam = 0 And lParam = 65535 Then
LblStatus.Caption = ""
Exit Sub
'respond to custom sysmenu dragging
ElseIf wParam = 2001 Then
LblStatus.Caption = " This is test #1 in action"
Exit Sub
ElseIf wParam = 2002 Then
LblStatus.Caption = " This is test #2 in action"
Exit Sub
ElseIf wParam = 2003 Then
LblStatus.Caption = " This is test #3 in action"
Exit Sub
Else
'normal menu items
hMenu% = GetMenu(Me.hWnd)
ReturnString$ = Space$(255)
ret% = GetMenuString(hMenu%, wParam, ReturnString$, 255, 0)
ReturnString$ = TrimAtNull(ReturnString$)
'remove any Shortcut key text
pos% = InStr(ReturnString$, Chr$(9))
If pos% <> 0 Then ReturnString$ = Left$(ReturnString$, pos% - 1)
'now ReturnString$=the actual menu item text (including any ampersands)
Select Case ReturnString$
Case "Moving Captionless &Form...": SBmsg$ = "How to implement a moveable captionless form"
Case "Moving &Controls...": SBmsg$ = "How to move controls at run-time"
Case "E&xit": SBmsg$ = "End the Message.VBX demo"
Case "VBX Help &Contents...": SBmsg$ = "Display contents page of Message.HLP"
Case "VBX Help &Search...": SBmsg$ = "Start Message.HLP with a topical search"
Case "&About...": SBmsg$ = "Copyright message window"
Case "Catalog of &Products...": SBmsg$ = "Get our shareware catalog"
Case "Online &Registration...": SBmsg$ = "Instructions for registering through CIS"
Case "&Order Form...": SBmsg$ = "Get an Order Form for printing"
Case "&Evaluation Form...": SBmsg$ = "Get our product Evaluation Form"
Case "Shareware &Information...": SBmsg$ = "Get information on shareware"
End Select
LblStatus.Caption = " " + SBmsg$
Exit Sub
End If
End If
If Msg = WM_GetMinMaxInfo Then 'set min/max window dimensions
Dim MinMax As MinMaxInfo
MessageDataGet lParam, Len(MinMax), MinMax
ScreenWide% = (Screen.Width / Screen.TwipsPerPixelX) - 20
ScreenHigh% = (Screen.Height / Screen.TwipsPerPixelY) - 20
MinMax.ptMaxSize.x = ScreenWide% 'when maximized
MinMax.ptMaxSize.y = ScreenHigh% 'when maximized
MinMax.ptMaxPosition.x = 10 'when maximized
MinMax.ptMaxPosition.y = 0 'when maximized
MinMax.ptMaxTrackSize.x = ScreenWide% 'when normal
MinMax.ptMaxTrackSize.y = ScreenHigh% 'when normal
MinMax.ptMinTrackSize.x = 496 'when normal
MinMax.ptMinTrackSize.y = 300 'when normal
MessageDataSet lParam, Len(MinMax), MinMax
UseRetVal = 1'use our own return value
RetVal = 0
End If
If Msg = WM_SysCommand Then 'system menu click
If wParam = 2001 Then
TheMsg$ = "This is test #1..." + nl + nl
TheMsg$ = TheMsg$ + "You can do anything here."
MsgBox TheMsg$, 48, "Custom System Menu Response"
End If
If wParam = 2002 Then
TheMsg$ = "This is test #2..." + nl + nl
TheMsg$ = TheMsg$ + "You can do anything here too." + nl + nl
TheMsg$ = TheMsg$ + "'This is test #1' is DISABLED!"
MsgBox TheMsg$, 48, "Custom System Menu Response"
SysMenuDisable Me, 2001
End If
If wParam = 2003 Then
TheMsg$ = "This is test #3..." + nl + nl
TheMsg$ = TheMsg$ + "You can do anything here as well." + nl + nl
TheMsg$ = TheMsg$ + "'This is test #1' is ENABLED!"
MsgBox TheMsg$, 48, "Custom System Menu Response"
SysMenuEnable Me, 2001
End If
End If
End Sub
Sub mnuDemos_Click ()
mnuDemosMoveControl.Enabled = True
If DisplayedMoveCtl = True Then
If MoveCtl.WindowState = 0 Then
mnuDemosMoveControl.Enabled = False
End If
End If
End Sub
Sub mnuDemosExit_Click ()
End
End Sub
Sub mnuDemosMoveControl_Click ()
If DisplayedMoveCtl = True Then
MoveCtl.SetFocus
MoveCtl.WindowState = 0
Else
Screen.MousePointer = 11
MoveCtl.Show
End If
End Sub
Sub mnuDemosMoveForm_Click ()
Screen.MousePointer = 11
FormMove.Show 1
End Sub
Sub mnuHelpAbout_Click ()
Screen.MousePointer = 11
About.Show 1
End Sub
Sub mnuHelpCatalog_Click ()
On Error Resume Next
WinPath$ = GetWinDir()
WinPath$ = BackSlashAdd(WinPath$) + "WRITE.EXE"
DocPath$ = App.Path
If InStr(DocPath$, "\VB\DPTOOLS") Then
DocPath$ = Left$(DocPath$, 2) + "\VB\DPTOOLS"
End If
DocPath$ = BackSlashAdd(DocPath$) + "DPCT0195.WRI"
FullPath$ = WinPath$ + " " + DocPath$
Screen.MousePointer = 11
x = Shell(FullPath$, 3)
Screen.MousePointer = 0
End Sub
Sub mnuHelpContents_Click ()
On Error Resume Next
MyHelpFile$ = App.Path
MyHelpFile$ = BackSlashAdd(MyHelpFile$) + "MESSAGE.HLP"
Screen.MousePointer = 11
ret% = WinHelp(Me.hWnd, MyHelpFile$, HELP_CONTENTS, 0&)
Screen.MousePointer = 0
End Sub
Sub mnuHelpEval_Click ()
On Error Resume Next
WinPath$ = GetWinDir()
WinPath$ = BackSlashAdd(WinPath$) + "WRITE.EXE"
DocPath$ = App.Path
If InStr(DocPath$, "\VB\DPTOOLS") Then
DocPath$ = Left$(DocPath$, 2) + "\VB\DPTOOLS"
End If
DocPath$ = BackSlashAdd(DocPath$) + "EVALFRM.WRI"
FullPath$ = WinPath$ + " " + DocPath$
Screen.MousePointer = 11
x = Shell(FullPath$, 3)
Screen.MousePointer = 0
End Sub
Sub mnuHelpOrder_Click ()
On Error Resume Next
WinPath$ = GetWinDir()
WinPath$ = BackSlashAdd(WinPath$) + "WRITE.EXE"
DocPath$ = App.Path
If InStr(DocPath$, "\VB\DPTOOLS") Then
DocPath$ = Left$(DocPath$, 2) + "\VB\DPTOOLS"
End If
DocPath$ = BackSlashAdd(DocPath$) + "ORDERFRM.WRI"
FullPath$ = WinPath$ + " " + DocPath$
Screen.MousePointer = 11
x = Shell(FullPath$, 3)
Screen.MousePointer = 0
End Sub
Sub mnuHelpReg_Click ()
On Error Resume Next
WinPath$ = GetWinDir()
WinPath$ = BackSlashAdd(WinPath$) + "WRITE.EXE"
DocPath$ = App.Path
If InStr(DocPath$, "\VB\DPTOOLS") Then
DocPath$ = Left$(DocPath$, 2) + "\VB\DPTOOLS"
End If
DocPath$ = BackSlashAdd(DocPath$) + "OnlineRg.WRI"
FullPath$ = WinPath$ + " " + DocPath$
Screen.MousePointer = 11
x = Shell(FullPath$, 3)
Screen.MousePointer = 0
End Sub
Sub mnuHelpSearch_Click ()
On Error Resume Next
MyHelpFile$ = App.Path
MyHelpFile$ = BackSlashAdd(MyHelpFile$) + "MESSAGE.HLP"
Screen.MousePointer = 11
ret% = WinHelp(Me.hWnd, MyHelpFile$, HELP_PARTIALKEY, "")
Screen.MousePointer = 0
End Sub
Sub mnuHelpShareware_Click ()
On Error Resume Next
WinPath$ = GetWinDir()
WinPath$ = BackSlashAdd(WinPath$) + "WRITE.EXE"
DocPath$ = App.Path
If InStr(DocPath$, "\VB\DPTOOLS") Then
DocPath$ = Left$(DocPath$, 2) + "\VB\DPTOOLS"
End If
DocPath$ = BackSlashAdd(DocPath$) + "SHARWARE.WRI"
FullPath$ = WinPath$ + " " + DocPath$
Screen.MousePointer = 11
x = Shell(FullPath$, 3)
Screen.MousePointer = 0
End Sub
Sub PicStatus_Paint ()
DoPicture3D PicStatus, "raised", 2, 0
DoPicChild3D LblStatus, "sunken", 1
DoPicChild3D LblSBtime, "sunken", 1
DoPicChild3D LblSBdate, "sunken", 1
DoPicChild3D LblSBnum, "sunken", 1
DoPicChild3D LblSBcaps, "sunken", 1
End Sub
Sub PicStatus_Resize ()
LblSBnum.Left = PicStatus.Width - 780
LblSBcaps.Left = LblSBnum.Left - 720
PicStatus.Cls
PicStatus_Paint
End Sub
Sub Timer1_Timer ()
'StatusBar Time
ThisTime$ = LCase$(Format$(Now, "medium time"))
If Left$(ThisTime$, 1) = "0" Then
ThisTime$ = Right$(ThisTime$, Len(ThisTime$) - 1)
End If
LblSBtime.Caption = ThisTime$
'StatusBar Date
ThisDate$ = Format$(Now, "medium date")
ThisDate$ = replace(ThisDate$, "-", " ")
LblSBdate.Caption = ThisDate$
'NumLock
If GetStateOfKey("NumLock") Then
LblSBnum.Caption = "NUM"
Else
LblSBnum.Caption = ""
End If
'CapsLock
If GetStateOfKey("CapsLock") Then
LblSBcaps.Caption = "CAPS"
Else
LblSBcaps.Caption = ""
End If
End Sub